package com.lujieni.springbootrocketmq.service;

import com.lujieni.springbootrocketmq.dao.DepartmentDao;
import com.lujieni.springbootrocketmq.po.DepartmentPO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author：小鹿爱吃鱼
 * @Date: 2025/6/8 17:23
 * @Description:
 */
@Service
@RequiredArgsConstructor
public class DepartmentService {

    private final DepartmentDao departmentDao;

    @Transactional(rollbackFor = Exception.class)
    public void insertBatch(){

        DepartmentPO one = new DepartmentPO();
        one.setId(100);
        one.setName("公关部");
        one.setParentId(0);
        one.setIsActive(1);

        DepartmentPO two = new DepartmentPO();
        two.setId(101);
        two.setName("保安部");
        two.setParentId(0);
        two.setIsActive(1);

        departmentDao.insert(one);
        departmentDao.insert(two);


    }


}
